<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="ZH-CN">
<head>
<title>评阅教师分配设置</title>
<meta http-equiv="X-UA-Compatible" content="IE=9" >
<meta name="keywords" content="吉珠,吉林大学,吉林大学珠海学院,吉林大学珠海学院论文管理">
<meta name="content-type" content="text/html" charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="<%=request.getContextPath()%>/pages1/css/bootstrap.css" type="text/css">
<link rel="stylesheet" href="<%=request.getContextPath()%>/pages1/css/flow.css" type="text/css">
<script src="<%=request.getContextPath()%>/pages1/js/jquery-2.1.1.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/pages1/js/bootstrap.js" type="text/javascript"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/jquery-easyui-1.4.1/jquery.min.js"></script>
<link rel="stylesheet" href="<%=request.getContextPath()%>/jquery-easyui-1.4.1/themes/gray/easyui.css" type="text/css"></link>
<link rel="stylesheet" href="<%=request.getContextPath()%>/jquery-easyui-1.4.1/themes/icon.css" type="text/css"></link>
<script type="text/javascript" src="<%=request.getContextPath()%>/jquery-easyui-1.4.1/locale/easyui-lang-zh_CN.js"></script>
<style>
.col-xs-3 {
	padding: 1px;
	height:860px;
}
.col-xs-9 {
	height: 860px;
}
#xs12 {
	height: 754px;
	width: 313px;
}
#li1{
	list-style-type:none;
	 }
</style>
<script type="text/javascript" language="javascript">
function g(o){return document.getElementById(o);}
function hoverli(n){
for(var i=1;i<=28;i++){
{g('tb_'+i).className='';}
g('tb_'+n).className='actived';}
}
function show(id){
var traget=document.getElementById(id);
traget.style.display="block"; 
}

function hide(id){
var traget=document.getElementById(id);
traget.style.display="none"; 
}

$(function(){
	tableTeacher();
	$('#teahcerList').combobox({
    	url:'<%=request.getContextPath()%>/setSecretary/teacherList',
		valueField:'teacher_id',
		textField:'teacher_name',
		});
});

function tableTeacher(){
	console.info("2");
	var set_table= $('#teacherTable').datagrid({
		url:'<%=request.getContextPath()%>/setSecretary/guideRelajudgeTable',
//		title:'综合设置',
		pagination : true,
		pageSize : 5,
		pageList : [ 5],
		singleSelect : true,
		fitColumns : true,
		rownumbers : true,
		columns : [ [
				{
					title : '系名称',
					field : 'department_name',
					width : 100,
					align : 'center',
					formatter : function(value, row, index) {
						var a = row.department_name;
						return a;
					}
				},
				{
					title : '教师工号',
					field : 'teacher_no',
					width : 50,
					align : 'center',
					formatter : function(value, row, index) {
						var a = row.teacher_no;
						return a;
					}
				},
				{
					title : '教师姓名',
					field : 'teacher_name',
					width : 40,
					align : 'center',
					formatter : function(value, row, index) {
						var a = row.teacher_name;
						return a;
					}
				},
				{
					title : '专业方向',
					field : 'teacher_research',
					width : 50,
					align : 'center',
					formatter : function(value, row, index) {
						var a = row.teacher_research;
						return a;
					}
				},
				{
					title : '职称/职位',
					field : 'zhicheng_name',
					width : 50,
					align : 'center',
					formatter : function(value, row, index) {
						var a = row.zhicheng_name;
						return a;
					}
				},
				{
					title : '学历',
					field : 'teacher_xueli',
					width : 50,
					align : 'center',
					formatter : function(value, row, index) {
						var a = row.teacher_xueli;
						return a;
					}
				},
				{
					title : '评阅老师姓名',
					field : 'teacher_name1',
					width : 50,
					align : 'center',
					formatter : function(value, row, index) {
						var a = row.teacher_name1;
						return a;
					}
				},
				]],
	});
}

function searchTable() 
{
	var tchId = $('#teahcerList').combobox('getValue');
	console.info(tchId);
	if(tchId==null || tchId=="")
	{
		tableTeacher();
	}
	else
	{
		var set_table= $('#teacherTable').datagrid({
		url:'<%=request.getContextPath()%>/setSecretary/guideRelajudge_teacher?tchId='+tchId+'',
//		title:'综合设置',
		pagination : true,
		pageSize : 5,
		pageList : [ 5],
		singleSelect : true,
		fitColumns : true,
		rownumbers : true,
		columns : [ [
				{
					title : '系名称',
					field : 'department_name',
					width : 100,
					align : 'center',
					formatter : function(value, row, index) {
						var a = row.department_name;
						return a;
					}
				},
				{
					title : '教师工号',
					field : 'teacher_no',
					width : 50,
					align : 'center',
					formatter : function(value, row, index) {
						var a = row.teacher_no;
						return a;
					}
				},
				{
					title : '教师姓名',
					field : 'teacher_name',
					width : 40,
					align : 'center',
					formatter : function(value, row, index) {
						var a = row.teacher_name;
						return a;
					}
				},
				{
					title : '专业方向',
					field : 'teacher_research',
					width : 50,
					align : 'center',
					formatter : function(value, row, index) {
						var a = row.teacher_research;
						return a;
					}
				},
				{
					title : '职称/职位',
					field : 'zhicheng_name',
					width : 50,
					align : 'center',
					formatter : function(value, row, index) {
						var a = row.zhicheng_name;
						return a;
					}
				},
				{
					title : '学历',
					field : 'teacher_xueli',
					width : 50,
					align : 'center',
					formatter : function(value, row, index) {
						var a = row.teacher_xueli;
						return a;
					}
				},
				{
					title : '评阅老师姓名',
					field : 'teacher_name1',
					width : 50,
					align : 'center',
					formatter : function(value, row, index) {
						var a = row.teacher_name1;
						return a;
					}
				},
				]],
	});
	}
}

/**
*上传方法
**/
function uploadFile(form) {
      var path=form.inputfile.value;
         if(path==""){
      alert("请选择上传文件");
          return;
      }
     var index=path.lastIndexOf(".");
      var result =path.substr(index+1);
      //alert(result);
     
      if(result!="xls")
      {
        alert("请上传文件格式为xls的文件");
          return;
      }
      
      var traget=document.getElementById("butToprogress");
      traget.innerHTML= "<p align='center'><progress id='progressBar' value='0' max='100'></progress><span id='percentage'></span></p>";

        var fd = new FormData();
        fd.append("表格", document.getElementById('inputfile').files[0]);
        var xhr = new XMLHttpRequest();
        xhr.upload.addEventListener("progress", progressFunction, false);
        xhr.addEventListener("load", uploadComplete, false);
        xhr.addEventListener("error", uploadFailed, false);
        xhr.addEventListener("abort", uploadCanceled, false);
        xhr.open("POST", "<%=request.getContextPath()%>/setSecretary/importExcel_gTch_jTch");
        xhr.send(fd);
      }
      
        function progressFunction(evt) {

            var progressBar = document.getElementById("progressBar");

            var percentageDiv = document.getElementById("percentage");

            if (evt.lengthComputable) {

                progressBar.max = evt.total;

                progressBar.value = evt.loaded;

                percentageDiv.innerHTML = Math.round(evt.loaded / evt.total * 100) + "%";

            }

        }  
        
      function uploadComplete(evt) {
        /* This event is raised when the server send back a response */
       
      alert(evt.target.responseText);
      
     
            // file.outerHTML = file.outerHTML;  
      //$.messager.alert("操作提示", "成功");
     parent.location.reload();//刷新页面
      }

      function uploadFailed(evt) {
        alert("上传失败");
      }

      function uploadCanceled(evt) {
        alert("上传已经取消");
      }
      
      function autoAllot() {
		$.ajax({
			url:'<%=request.getContextPath()%>/setSecretary/autoAllot_gTch_jTch',
			success:function(r){
				if(r.success)
					$.messager.alert('提示', '分配成功', 'info', function(){
						javascript: window.location.reload();
					});
				else
					$.messager.alert('提示', '分配失败，请重新分配', 'info', function(){
						javascript: window.location.reload();
					});
			},
		});
	}
			function showWhat()
		{
			var collap=document.getElementById('collapseHelp');
			if(collap.style.display=='none')
				collap.style.display='block';
			else
				collap.style.display='none';
		}
</script>
</head>

<body>
<!--全局框架 开始 conteiner-->
<div class="container">
<!--标题头图片-->
<div class="row">
  <div class="body_top"> <img src="<%=request.getContextPath()%>/pages1/img/head.png" align="center" width="1280px"/> </div>
</div>
<!--全局12栅格 规划全局区域图线 开始 row+ col-->
<div class="row">
<jsp:include page="secretary_siderbar.jsp"></jsp:include>
    
    <!--左侧跳转框架结束--> 
    <!--右侧用户操作模块 占全局9栅格-->
    <div class="col-xs-9"style="border:2px solid #25465d">
      <div class="row">
        <div class="col-xs-4  xs11" style="margin-top:2px; margin-bottom:0px;"> <strong><font size="3">流程管理》评阅教师分配设置 </font></strong> </div>
      </div>
      <div class="col-xs-11  xs11" style="margin-top:2px; margin-bottom:0px;">
        <div class="panel panel-default" style="margin-top:2px; margin-bottom:10px;">
          <div class="panel-heading" align="left"> <a data-toggle="collapse" data-parent="#accordion"  href="#collapseHelp" class="glyphicon glyphicon-chevron-down" onclick="showWhat()"> 操作指南 </a> </div>
          <div id="collapseHelp" class="panel-collapse collapse">
            <div class="panel-body">评阅教师分配设置：
              <ul>
                <li>教学秘书可以通过查询按键查找某个教师目前学生分配评阅论文导师的情况。</li>
                <li>教学秘书可以通过手工分配来分配评阅教师。</li>
                <li>教学秘书也可以对于教师总数为偶数的教师采取自动匹配的方案，实现评阅教师的分配。</li>
                <li>教学秘书也可以根据教师私下相互匹配的名单，设计好评阅教师分配关系模板，通过系统导入的方式，一次导入指导教师和评阅教师的关联关系表。</li>
              </ul>
            </div>
          </div>
        </div>
        
        <div class="col-xs-12" style="margin-top:5px; margin-bottom:10px;height:230px;" >
          <p><b>评阅教师分配查询</b></p>
          <p>所属系名称:&nbsp&nbsp&nbsp&nbsp
            <select disabled="disabled">
              <option value="1">计算机科学与技术系</option>
            </select>
            &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp 
       
            教师姓名：&nbsp&nbsp&nbsp&nbsp
            <input name="teahcerList" id="teahcerList" value=""/>
            &nbsp&nbsp&nbsp&nbsp &nbsp&nbsp&nbsp&nbsp
            <button type="button" class="btn btn-info btn-xs" onclick="searchTable()">&nbsp;&nbsp;查询&nbsp;&nbsp;</button>
            &nbsp&nbsp&nbsp&nbsp </p>
            
 
            <table id="teacherTable" class="table table-hover table-bordered" style="margin-top:0px; margin-bottom:0px;width:740px;">
<!--               <thead>
                <tr>
                  <th width="5%" class="info">No.</th>
                  <th  width="17%"class="info"><font size="2">系名称</th>
                    </font>
                  <th width="10%" class="info"><font size="2">教师工号</th>
                    </font>
                  <th width="10%" class="info"><font size="2">教师姓名</th>
                    </font>
                  <th width="15%" class="info"><font size="2">专业方向</th>
                    </font>
                  <th width="12%" class="info"><font size="2">职称/职务</th>
                    </font>
                  <th width="16%" class="info"><font size="2">学历</th>
                    </font>
                  <th width="15%"class="info"><font size="2">评阅教师姓名</th>
                    </font>
                </tr>
              </thead>
            
                <tbody>
                  <tr>
                    <td>1</td>
                    <td>计算机科学与技术系</td>
                    <td>06008</td>
                    <td>陈守孔</td>
                    <td>计算机科学与技术</td>
                    <td >教授/系主任</td>
                    <td>本科</td>
                    <td>张三</td>
                  </tr>
                  <tr>
                    <td >1</td>
                    <td >计算机科学与技术系</td>
                    <td >06008</td>
                    <td >陈守孔</td>
                    <td >计算机科学与技术</td>
                    <td >教授/系主任</td>
                    <td>本科</td>
                    <td>张三</td>
                  </tr>
                  <tr>
                    <td >1</td>
                    <td >计算机科学与技术系</td>
                    <td >06008</td>
                    <td >陈守孔</td>
                    <td >计算机科学与技术</td>
                    <td >教授/系主任</td>
                    <td>本科</td>
                    <td>张三</td>
                  </tr>
                </tbody>
                 -->
              </table>
            
       
          
         <hr/>
        </div>
         
             <div class="col-xs-12" style="margin-top:35px; height:130px;">
		          <p><b>评阅教师自动分配方案1：</b></p>
		          
		          <div class="col-xs-3" style="height:10px;">
		 
		    <p>评阅教师分配名单导入：</p> 
		    </div>
		<form id="fileupload" action="${pageContext.request.contextPath}/setSecretary/importExcel_gTch_jTch" method="post" enctype="multipart/form-data">     
		 <div class="col-xs-8" style="border:1px solid #25465d ; background-color:#d8d8d8; width:300px;height:30px;">
		      <label class="sr-only" for="inputfile">文件输入</label>
		            <input type="file" id="inputfile">
		</div>
		  <div class="col-xs-4" >
		     <button type="button" class="btn btn-success btn-sm" onclick="uploadFile(fileupload)" value="刷新"/>导入设置</button> 
		     </div> 
		  </form>   
		     <br />
		
		       <div id="butToprogress"></div> 
		       </div>
         
        <div class="col-xs-12" style="margin-top:50px;  height:230px;" >
          <p><b>评阅教师自动分配方案2：</b></p>
           <div class="col-xs-1" style="margin-top:5px;" >
		     <button type="button" class="btn btn-success btn-sm" onclick="autoAllot()" value="刷新"/>随机匹配</button> 
		    
		     </div>
     </div>
    
<!--        <div class="col-xs-12" style="margin-top:35px; height:130px;">
          <p><b>评阅教师自动分配方案：</b></p>
          
          <div class="col-xs-3" style="height:10px;">
    <p>评阅教师分配名单导入：</p> 
    </div>     
 <div class="col-xs-8" style="border:1px solid #25465d ; background-color:#d8d8d8; width:300px;height:30px;">
      <label class="sr-only" for="inputfile">文件输入</label>
            <input type="file" id="inputfile">
</div>
  <div class="col-xs-4" >
     <button type="button" class="btn btn-success btn-sm" onclick="javascript:window.location.reload()" value="刷新"/>导入设置</button> 
     </div> 
     
     <br />

     <div class="col-xs-3" style=" height:10px;margin-top:5px;">
    <p>指导教师名单导入：</p> 
    </div>     
 <div class="col-xs-8" style="border:1px solid #25465d ; background-color:#d8d8d8; width:300px;height:30px;margin-top:5px;">
      <label class="sr-only" for="inputfile">文件输入</label>
            <input type="file" id="inputfile">
</div>
  <div class="col-xs-1" style="margin-top:5px;" >
     <button type="button" class="btn btn-success btn-sm" onclick="javascript:window.location.reload()" value="刷新"/>随机匹配</button> 
    
     </div>      
       </div>-->
        </div>
          </div>
          </div>
    
      
      <!--修改结束--> 
    </div>
    <!--全局12栅格 规划全局区域图线 结束 row+ col--> 
  </div>
  <div class="row" style="background-color:#25465d"">
    <p  align="center" style="color:white;background-color:#25465d"><strong>用户单位：</strong>吉林大学珠海学院&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>版权所有：</strong>吉林大学珠海学院计算机科学与技术系</p>
  </div>
  <!--全局框架结束 conteiner--> 
</div>
</body>
</html>
